<?php
namespace core\extend;

class TimeHandle
{
    /**
     * 根据日期获取是周几
     * @param string $time 时间戳
     * @return string
     */
    public function getWeekDate($time = '')
    {
        $week = ['周日','周一','周二','周三','周四','周五','周六'];
        return $week[date("w", !empty($time)? $time: time())];
    }

    /**
     * 计算两个时间相差的天数
     * @param $startTime 起始时间戳
     * @param $endTime 结尾时间戳
     * @return false|float
     */
    public function getDifferDayNumber($startTime, $endTime)
    {
        $differ = $endTime - $startTime;
        return floor($differ/86400);
    }

}